package com.example.chongwushangcheng.enums;

public enum PetSpecialPerformanceStatusEnum {

    // 枚举常量
    NOT_STARTED(0, "未开始"),
    IN_PROGRESS(1, "进行中"),
    ENDED(2, "已结束");

    // 成员变量
    private final int code;
    private final String description;

    // 构造函数
    PetSpecialPerformanceStatusEnum(int code, String description) {
        this.code = code;
        this.description = description;
    }

    // 获取 code 的方法
    public int getCode() {
        return code;
    }

    // 获取 description 的方法
    public String getDescription() {
        return description;
    }

    // 根据 code 获取对应的枚举对象
    public static PetSpecialPerformanceStatusEnum fromCode(int code) {
        for (PetSpecialPerformanceStatusEnum type : PetSpecialPerformanceStatusEnum.values()) {
            if (type.getCode() == code) {
                return type;
            }
        }
        throw new IllegalArgumentException("Invalid code: " + code);
    }
}